package moodish.base;

import java.util.LinkedList;

public class User {

	String username;
	String mood = "";
	LinkedList<User> friendList = new LinkedList<User>();
	
	public User(String s) {
		username = s;
	}
	
	public void setMood(String mood) {
		this.mood = mood.toString();
	}

	public String getMood() {
		return mood;
	}
	
	public String getUsername() {
		return username;
	}
	
	public boolean addFriend(User friend) {
		for (User friendExists : friendList) {
			if (friendExists.equals(friend)) return false;
		}
		friendList.add(friend);
		return true;
	}
	
	public boolean removeFriend(User friend) {
		for (User friendExists : friendList) {
			if (friendExists.equals(friend)) {
				friendList.remove(friend);
				return true;
			}
		}
		return false;
	}
	
	public LinkedList<User> getFriends() {
		return friendList;
	}
	
	public String toString() {
		return username + " is feeling " + mood;
	}
}
